<?php
namespace app\admin\controller;

use app\admin\service\AddonsService;

class Addons extends CommonController
{
    /**
     * 插件首页
     * @return
     */
    public function index()
    {
        $data = AddonsService::getList();
        return view('addons/index', ['data' => $data]);
    }

    /**
     * 插件安装
     */
    public function install()
    {
        $request = $this->request;
        AddonsService::install($request['keyname']);
        return $this->success();
    }

    /**
     * 插件卸载
     */
    public function uninstall()
    {
        $request = $this->request;
        AddonsService::uninstall($request['keyname']);
        return $this->success();
    }
}
